import { CoolController, BaseController } from "@cool-midway/core";
import { ProviderTeamEntity } from "../../entity/team";
import { ProviderProfileEntity } from "../../entity/profile";

/**
 * 服务团队管理
 */
@CoolController({
    api: ['add', 'delete', 'update', 'info', 'list', 'page'],
    entity: ProviderTeamEntity,
    pageQueryOp: {
        keyWordLikeFields: ['a.name'],
        fieldEq: ['a.isTenant'],
        select: ['a.*', 'b.name as ownerName', 'b.photo as ownerPhoto'],
        join: [
            {
                entity: ProviderProfileEntity,
                alias: 'b',
                condition: 'a.ownerProviderId = b.providerId',
                type: 'leftJoin'
            }
        ]
    }
})
export class AdminProviderTeamController extends BaseController { }

